<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: yuzi
  Date: 2018/4/20
  Time: 23:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="input" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>添加用户</title>
</head>
<body>
<form action="${pageContext.request.contextPath}/user/testUserConverter">
    <%--张三-123456-22-1-zhangsan@163.com-学府街-太原--%>
    <span>测试converter</span><br>
    <span>格式如：张三-123456-22-1-zhangsan@163.com-学府街-太原</span><br>
    <input type="text" name="user" size="50">
    <br>
    <input type="submit" value="提交">
</form>

<form:form action="${pageContext.request.contextPath}/user/user" commandName="user">
    <c:if test="${user.id != null}">
        <input type="hidden" name="_method" value="PUT">
        <form:hidden path="id"></form:hidden>
    </c:if>
    <c:if test="${user.id == null}">
        <input type="hidden" name="_method" value="POST">
    </c:if>
    用户名：<form:input path="userName"></form:input><span style="color: red">*</span>
    <span style="color: red"><form:errors path="userName"></form:errors></span>
    <br>
    <c:if test="${user.id == null}">
        密码：<form:input path="passWord"></form:input>
        <br>
    </c:if>
    年龄：<form:input path="userAge"></form:input><span style="color: red">*</span>
    <span style="color: red"><form:errors path="userAge"></form:errors></span>
    <br>
    邮箱：<form:input path="email"></form:input><span style="color: red">*</span>
    <span style="color: red"><form:errors path="email"></form:errors></span>
    <br>
    性别：<br>
    <form:radiobuttons path="gender" items="${genders}" delimiter="<br>"></form:radiobuttons>
    <br>
    街道：<form:select path="aderess.id" items="${aderessList}" itemLabel="street" itemValue="id"></form:select>
    <br>
    生日：<form:input path="birthDay"></form:input><span style="color: red">*</span>
    <span style="color: red"><form:errors path="birthDay"></form:errors></span>
    <br>
    工资：<form:input path="salary"></form:input><span style="color: red">*</span>
    <span style="color: red"><form:errors path="salary"></form:errors></span>
    <input type="submit" value="提交">
</form:form>
</body>
</html>
